import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Toolkit;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.SwingConstants;
import org.eclipse.wb.swing.FocusTraversalOnArray;
import java.awt.Component;
import javax.swing.JLayeredPane;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;


public class TitleScreen extends JFrame implements KeyListener {

	private JPanel contentPane;
	static JLabel label_1 = new JLabel("");
	
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					final TitleScreen frame = new TitleScreen();
					
					frame.setLocationRelativeTo(null);
					frame.setVisible(true);
					
//					for (int i = 0; i < 100; i++)
//					{
//						label_1.setVisible(true);
//						Thread.sleep(1000);
//						label_1.setVisible(false);
//						Thread.sleep(1000);
//						
//					}
					
					frame.addKeyListener(new KeyAdapter()
					{
						@Override
						public void keyPressed(KeyEvent arg0)
						{
							int id = arg0.getKeyCode();
								if (id == KeyEvent.VK_ENTER)
								{
									MainMenu frame2 = new MainMenu();
									frame.setVisible(false);
									frame2.setVisible(true);
								}
						}
					});

					
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public TitleScreen() {

		setTitle("Typing Tron 4000");
		setResizable(false);
		this.setFocusable(true);
		this.setLocationRelativeTo(null);
		setBackground(new Color(155, 80, 184));
		getContentPane().setLayout(null);
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 800, 600);
		contentPane = new JPanel();
		contentPane.setBackground(new Color(155, 80, 184));
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblNewLabel = new JLabel("");
		lblNewLabel.setBounds(0, 0, 794, 567);
		lblNewLabel.setBackground(new Color(155, 80, 184));
		lblNewLabel.setIcon(new ImageIcon("C:\\Users\\Deposition\\workspace\\TypingTron\\titlescreengoodresizenotrans.png"));
		getContentPane().add(lblNewLabel);
		
		JPanel panel = new JPanel();
		panel.setBounds(0, 0, 794, 110);
		panel.setBackground(new Color(200, 191, 231));
		contentPane.add(panel);
		
		JLayeredPane layeredPane = new JLayeredPane();
		layeredPane.setBounds(124, 445, 600, 94);
		contentPane.add(layeredPane);
		
		JLabel label_1 = new JLabel("");
		label_1.setBounds(0, 0, 600, 83);
		layeredPane.add(label_1);
		label_1.setIcon(new ImageIcon("C:\\Users\\Deposition\\workspace\\TypingTron\\Dialog.png"));
		contentPane.setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[]{lblNewLabel, panel, label_1}));
	}

	@Override
	public void keyPressed(KeyEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void keyReleased(KeyEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void keyTyped(KeyEvent arg0) {
		// TODO Auto-generated method stub
		
	}
}
